﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NXBSaiGon
{
    public partial class ManageBasket : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack) return;
        }
        public DataTable getgiohang()
        {
            Basket gio = (Basket)Session["GioHang"];
            if (gio != null)
            {
                return gio.Data;
            }
            return null;
        }

        public bool RemoveCartItem(string id)
        {
            Basket gio = (Basket)Session["GioHang"];
            if (gio.isExits(id))
            {
                gio.Remove(id);
                
                return true;
            }
            return false;
        }

        public bool UpdateCart(string displayname, string price, string quantity, string total, string id)
        {
            Basket gio = (Basket)Session["GioHang"];
            if (gio.isExits(id))
            {
                gio.UpdateQuantity(id, int.Parse(quantity));
                return true;

            }
            return false;
        }
    }
}